package com.day3me.java;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

public class RunTest {
    public static void main(String[] args) {
        Tortoise tro = new Tortoise();
        Rabbit rab = new Rabbit();
        new Thread(tro).start();
        new Thread(rab).start();
    }
}

class Tortoise extends Thread{
    @Override
    public void run() {
        for(int i = 1; i <=30; i++){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("乌龟向前跑了一米~~~~~~~~~~");
            if(i==30){
                System.out.println("乌龟到达终点，哈哈哈~~~~~~~~~~~~");
                break;
            }
            if(i%10==0){
                try{
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

class Rabbit extends Thread{
    @Override
    public void run() {
        for(int i = 1; i<=30 ; i++){
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("兔子向前跑了一米=========");
            if(i==30) {
                System.out.println("兔子到达终点，哈哈哈===============");
                break;
            }
       if(i%10==0){
           try {
               Thread.sleep(10000);
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
       }

        }
    }
}